import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import MainScreen from '../views/MainScreen.vue'
const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path:'/register',
    name:'Register',
    component:Register
  },
  {
    path:'/mainscreen',
    name:'MainScreen',
    component: MainScreen,
    children:[
      {
        path:'/chat',
        name:'Chat',
        component:() => import('../views/Chat.vue')
      },
      {
        path:'/groupchat',
        name:'GroupChat',
        component:()=>import('../views/GroupChat.vue')
      },
      {
        path:'/setting',
        name:'Setting',
        component:()=>import('../views/Setting.vue')
      },
      
    ]
  },
  {
        path:'/mainchatcontent/',
        name:'MainChatContent',
        component:()=>import('../views/MainChatContent.vue')
      }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

router.beforeEach((to,from)=>{

})
export default router
